﻿<UserControl x:Class="Mosaic.Controls.PeopleItem"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             Margin="5,5,0,5" RenderTransformOrigin="0.5,0.5"
             MouseLeftButtonDown="UserControlMouseLeftButtonDown" MouseLeftButtonUp="UserControlMouseLeftButtonUp" MouseLeave="UserControlMouseLeave">
    <UserControl.Resources>
        <Storyboard x:Key="MouseDownAnim">
            <DoubleAnimation Storyboard.TargetName="Scale" Storyboard.TargetProperty="ScaleX" To="0.95" Duration="0:0:0.05" AccelerationRatio="0.3" DecelerationRatio="0.7"/>
        </Storyboard>
        <Storyboard x:Key="MouseUpAnim">
            <DoubleAnimation Storyboard.TargetName="Scale" Storyboard.TargetProperty="ScaleX" To="1" Duration="0:0:0.05" AccelerationRatio="0.3" DecelerationRatio="0.7"/>
        </Storyboard>
    </UserControl.Resources>
    <UserControl.Triggers>
        <EventTrigger RoutedEvent="UserControl.Loaded">
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="Translate" Storyboard.TargetProperty="X" From="100" To="0" Duration="0:0:0.3" AccelerationRatio="0.3" DecelerationRatio="0.3"/>
                    <DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.2" AccelerationRatio="0.5"/>
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </UserControl.Triggers>
    <UserControl.RenderTransform>
        <TransformGroup>
            <ScaleTransform x:Name="Scale" ScaleX="1" ScaleY="{Binding ElementName=Scale, Path=ScaleX}"/>
            <TranslateTransform x:Name="Translate"/>
        </TransformGroup>
    </UserControl.RenderTransform>
    <DockPanel>
        <Image Name="Image" DockPanel.Dock="Left" Stretch="UniformToFill" HorizontalAlignment="Center" Width="50" Height="50"/>
        <TextBlock Name="Title" Margin="10,0,0,0" Foreground="White" FontSize="22" TextWrapping="Wrap" VerticalAlignment="Center"/>
    </DockPanel>
</UserControl>
